#ifndef ITEM_H
#define ITEM_H


#include "data_global.h"
#include "abstractdata.h"
#include "metadata.h"


#include <abstractmodelitem.h>


#include <QObject>
#include <QVariant>
#include <QMetaType>
#include <QPointer>
#include <QList>
#include <collection.h>


class Collection;
class MetaData;


class DATASHARED_EXPORT Item : public AbstractData
{
    Q_OBJECT

public:

    enum Role
    {
        EditTypeRole = Qt::UserRole + 1
    };

    Q_INVOKABLE Item(Collection *parent = 0);
    Item(const Item& other);

    QVariantMap values() const;
    void setValues(const QVariantMap& values);

    virtual QVariant value(int field, int role = Qt::DisplayRole) const;
    virtual void setValue(int field, const QVariant &value);

    virtual QStringList options(int field) const;
    virtual MetaData *metaData() const;

    QString optionReference(int field) const;
    int editType(int field) const;

    QVariantMap optionValues(int field) const;

};


typedef QPointer<Item> ItemPtr;


Q_DECLARE_METATYPE(Item*)


#endif // ITEM_H

